<?php
namespace app\api\controller;
use think\Controller;
use think\Request;
use think\Config;

class Chat
{
    public function index()
    {

    	$pushData = [
            'user_id' => rand(1000,9999),
            'game_id' => $_POST['game_id'],
            'content' => $_POST['content']
        ];

        //异步任务
        $_POST['swoole_ws']->task(['method'=>'pushDataToChat','data'=>$pushData]);

        return json_encode($pushData);
	    
    }
}
